﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Model
{   
    [Serializable]
    public class RiskMatrix{
        private string[,] rmMatrix;
        private string rm_r1;
        private string rm_r2;
        private string rm_r3;
        private string rm_r4;
        private string rm_r5;
        private string rm_c1;
        private string rm_c2;
        private string rm_c3;
        private string rm_c4;
        private string rm_c5;
        private string rmd_r11;
        private string rmd_r12;
        private string rmd_r13;
        private string rmd_r21;
        private string rmd_r22;
        private string rmd_r23;
        private string rmd_r31;
        private string rmd_r32;
        private string rmd_r33;
        private string rmd_r41;
        private string rmd_r42;
        private string rmd_r43;
        private string rmd_r51;
        private string rmd_r52;
        private string rmd_r53;
        private static string[,] matrix = new string[,]{
                                                        {"E","E","E","E","D"},
                                                        {"E","E","E","D","C"},
                                                        {"E","E","D","C","B"},
                                                        {"E","D","C","B","A"},
                                                        {"D","C","B","A","A"}
                                                     };

        public RiskMatrix()
            : this(matrix, "频繁(每年超过1次)", "较多(10年1次)", "偶尔(100年1次)", "极少(1000年1次)", "渺茫(10000年1次)",
                "*轻伤或刺激\n*泄漏至收集系统\n*停产<1天", "*误工伤害\n*泄漏在厂界内\n*停产<1周",
                "*残疾伤害\n*泄漏至厂界外\n*停产<1月", "*1人死亡\n*厂外人员伤残\n*停产<6月", "*多人死亡事故\n*厂外人员死亡\n*停产>6月","没有明显风险","E","没有整改要求，不必提建议措施",
            "低风险","D","可以考虑再增加安全措施，但无强制要求","中风险","C","必须有行政措施，尽可能采用工程措施","中-高风险","B","必须提供新的安全措施，至少有一项工程措施","高风险","A","需进一步开展LOPA分析或其它定量分析"){}

        public RiskMatrix(string[,] rmMatrix, string rmR1, string rmR2, string rmR3, string rmR4, string rmR5, string rmC1, string rmC2, string rmC3, string rmC4, string rmC5, string rmdR11, string rmdR12, string rmdR13, string rmdR21, string rmdR22, string rmdR23, string rmdR31, string rmdR32, string rmdR33, string rmdR41, string rmdR42, string rmdR43, string rmdR51, string rmdR52, string rmdR53){
            this.rmMatrix = rmMatrix;
            rm_r1 = rmR1;
            rm_r2 = rmR2;
            rm_r3 = rmR3;
            rm_r4 = rmR4;
            rm_r5 = rmR5;
            rm_c1 = rmC1;
            rm_c2 = rmC2;
            rm_c3 = rmC3;
            rm_c4 = rmC4;
            rm_c5 = rmC5;
            rmd_r11 = rmdR11;
            rmd_r12 = rmdR12;
            rmd_r13 = rmdR13;
            rmd_r21 = rmdR21;
            rmd_r22 = rmdR22;
            rmd_r23 = rmdR23;
            rmd_r31 = rmdR31;
            rmd_r32 = rmdR32;
            rmd_r33 = rmdR33;
            rmd_r41 = rmdR41;
            rmd_r42 = rmdR42;
            rmd_r43 = rmdR43;
            rmd_r51 = rmdR51;
            rmd_r52 = rmdR52;
            rmd_r53 = rmdR53;
        }


        public string[,] RmMatrix{
            get { return rmMatrix; }
            set { rmMatrix = value; }
        }

        public string RmR1{
            get { return rm_r1; }
            set { rm_r1 = value; }
        }

        public string RmR2{
            get { return rm_r2; }
            set { rm_r2 = value; }
        }

        public string RmR3{
            get { return rm_r3; }
            set { rm_r3 = value; }
        }

        public string RmR4{
            get { return rm_r4; }
            set { rm_r4 = value; }
        }

        public string RmR5{
            get { return rm_r5; }
            set { rm_r5 = value; }
        }

        public string RmC1{
            get { return rm_c1; }
            set { rm_c1 = value; }
        }

        public string RmC2{
            get { return rm_c2; }
            set { rm_c2 = value; }
        }

        public string RmC3{
            get { return rm_c3; }
            set { rm_c3 = value; }
        }

        public string RmC4{
            get { return rm_c4; }
            set { rm_c4 = value; }
        }

        public string RmC5{
            get { return rm_c5; }
            set { rm_c5 = value; }
        }

        public string RmdR11{
            get { return rmd_r11; }
            set { rmd_r11 = value; }
        }

        public string RmdR12{
            get { return rmd_r12; }
            set { rmd_r12 = value; }
        }

        public string RmdR13{
            get { return rmd_r13; }
            set { rmd_r13 = value; }
        }

        public string RmdR21{
            get { return rmd_r21; }
            set { rmd_r21 = value; }
        }

        public string RmdR22{
            get { return rmd_r22; }
            set { rmd_r22 = value; }
        }

        public string RmdR23{
            get { return rmd_r23; }
            set { rmd_r23 = value; }
        }

        public string RmdR31{
            get { return rmd_r31; }
            set { rmd_r31 = value; }
        }

        public string RmdR32{
            get { return rmd_r32; }
            set { rmd_r32 = value; }
        }

        public string RmdR33{
            get { return rmd_r33; }
            set { rmd_r33 = value; }
        }

        public string RmdR41{
            get { return rmd_r41; }
            set { rmd_r41 = value; }
        }

        public string RmdR42{
            get { return rmd_r42; }
            set { rmd_r42 = value; }
        }

        public string RmdR43{
            get { return rmd_r43; }
            set { rmd_r43 = value; }
        }

        public string RmdR51{
            get { return rmd_r51; }
            set { rmd_r51 = value; }
        }

        public string RmdR52{
            get { return rmd_r52; }
            set { rmd_r52 = value; }
        }

        public string RmdR53{
            get { return rmd_r53; }
            set { rmd_r53 = value; }
        }

        public override bool Equals(object obj){
            if(obj != null && obj is RiskMatrix){
                RiskMatrix r = (RiskMatrix) obj;
                if (this.rm_r1 == r.rm_r1 && this.rm_r2 == r.rm_r2 && this.rm_r3 == r.rm_r3
                    && this.rm_r4 == r.rm_r4 && this.rm_r5 == r.rm_r5 && this.rm_c1 == r.rm_c1
                    && this.rm_c2 == r.rm_c2 && this.rm_c3 == r.rm_c3 && this.rm_c4 == r.rm_c4
                    && this.rm_c5 == r.rm_c5 && this.rmd_r11 == r.rmd_r11 && this.rmd_r12 == r.rmd_r12
                    && this.rmd_r13 == r.rmd_r13 && this.rmd_r21 == r.rmd_r21 && this.rmd_r22 == r.rmd_r22
                    && this.rmd_r23 == r.rmd_r23 && this.rmd_r31 == r.rmd_r31 && this.rmd_r32 == r.rmd_r32
                    && this.rmd_r33 == r.rmd_r33 && this.rmd_r41 == r.rmd_r41 && this.rmd_r42 == r.rmd_r42
                    && this.rmd_r43 == r.rmd_r43 && this.rmd_r51 == r.rmd_r51 && this.rmd_r52 == r.rmd_r52
                    && this.rmd_r53 == r.rmd_r53 && this.rmMatrix == r.rmMatrix)
                    return true;
            }
            return false;
        }
    }
}
